package chenjiuxu.seniorui

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.View
import android.widget.Toast
import chenjiuxu.seniorui.view.LineTimerView


class LineTimerViewActivity : AppCompatActivity(), LineTimerView.OnTimerListener {


    var lineTimerView: LineTimerView? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_line_timer_view)
        lineTimerView = findViewById<LineTimerView>(R.id.activity_line_timer_view_ltv)
        lineTimerView!!.setOnTimerListener(this)
    }
    override fun stopListener(issmallTime: Boolean) {
        runOnUiThread{
            Toast.makeText(this, issmallTime.toString(), Toast.LENGTH_SHORT).show()
        }
    }
    fun click(v: View) {
        when (v.id) {
            R.id.start_time -> {
                lineTimerView!!.startTime()
            }
            R.id.stop_time -> {
                lineTimerView!!.stopTime()
            }
        }
    }

}
